<template>
	<view>
		<page-head :title="'试驾体验'" :headtype="2"></page-head>
		<view class="rotmsg">
			<view class="roteach flex" v-for="(item,index) in rotdata" :key="index" @click="apifun.navigate('/pages/home/testdrive','id='+item.id)">
				<view class="roteachimg">
					<image :src="apifun.URLimg+item.img" mode=""></image>
				</view>
				<view class="roteachdata">
					<view class="roteachname ellipsis01">{{ item.title }}</view>
					<view class="roteachtime">{{ item.create_time }}</view>
					<view class="roteachbm">{{ item.num }}人报名</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				apifun:this.apifun,
				page:1,
				rotdata:[],
			};
		},
		onLoad() {
			this.rotdatafun()
		},
		methods: {
			rotdatafun(){
				let sendData = {
					page:this.page,
					limit:this.apifun.limit
				}
				this.apifun.unirequest('/api/testDrive/getTestDriveList','post',sendData,(res)=>{
					if(res.code === 200){
						let datas = res.data;
						if(datas.data.length <= 0){
							this.page--
							return false
						}
						this.rotdata = [...this.rotdata,...datas.data]
					}else{
						this.apifun.toast(res.msg)
					}
				},false,true)
			}
		},
		onPullDownRefresh() {
			this.page = 1;
			this.rotdata = [];
			this.rotdatafun();
			uni.stopPullDownRefresh();
		},
		onReachBottom() {
			this.page++;
			this.rotdatafun()
		},
	};
</script>

<style scoped lang="scss">
	.rotmsg{
		.roteach{
			width: 650rpx;
			padding:20rpx;
			border-radius: 10rpx;
			margin: auto;
			margin-top: 20rpx;
			background: #fff;
			.roteachimg{
				width: 280rpx;
				height: 160rpx;
				padding-bottom: 20rpx;
				image{
					width: 280rpx;
					height: 160rpx;
					border-radius:10rpx;
				}
			}
			.roteachdata{
				margin-left: 20rpx;
				.roteachname{
					font-size: 30rpx;
					color: #222222;
					line-height: 60rpx;
					font-weight: 600;
				}
				.roteachtime{
					padding: 10rpx 0;
					font-size: 26rpx;
					color: #666666;
				}
				.roteachbm{
					display: inline-block;
					font-size: 24rpx;
					color: #0089FB;
					padding:0 10rpx;
					border-radius: 4rpx;
					background: #E7F2FF;
				}
			}
		}
	}
</style>